<h1><%= @title %></h1>
<% if @narratives.count > 0 %>
<% type=@narratives[0].narrative_type_id%>
<% if type==2%>
<% @medication=@narratives[0]%>
<div id='medications'>
	<%= render(:partial => "patients/medications") %>
</div>
<div id='allergies'>
	<h1>Allergies</h1>
	<%= render(:partial => "patients/allergies") %>
</div>
<% end %>

<div class="wedgetail-form">
<% count=0%>

<% for @narrative in @narratives %>
<% count=count+1%>
<% unless @narrative.narrative_type_id ==2 and count==1 %>
	<fieldset>
		<legend><%= @narrative.narrative_date.strftime("%d/%m/%y") if @narrative.narrative_date %>   <%= @narrative.title-%></legend>	
		<% content, partial = @narrative.convert %>
	<%= render(:partial=>partial,:object=>content)%>

		<br>
		<%= "Created by "+ @narrative.author + "<br>" if @narrative.author && @narrative.author!=""%>
		<%= link_to 'Update this '+ @narrative.narrative_type.narrative_type_name, :controller=>'entry',:action=>'new',:wedgetail=>@patient.wedgetail,:narrative=>@narrative.id if type !=2%>
	
	</fieldset>
<% end %>
<% end %>
<% else %>
None available<p>
<% end %>

</div>


<%= link_to "Back ", :controller=> :patients, :action=> :show, :id=>@patient.wedgetail %>